//
// Created by TheMorbidArk on 2022/11/3.
//

#ifndef VANTIDEL_CPP_CORE_H
#define VANTIDEL_CPP_CORE_H

#include "vm.h"

extern char* rootDir;
char* ReadFile(const char* sourceFile);
VMResult ExecuteModule(VM* vm, Value moduleName, const char* moduleCode);

int GetIndexFromSymbolTable(SymbolTable* table, const char* symbol, uint32_t length);
int AddSymbol(VM* vm, SymbolTable* table, const char* symbol, uint32_t length);
static ObjThread *LoadModule(VM *vm, Value moduleName, const char *moduleCode);
static ObjModule *GetModule(VM *vm, Value moduleName);

void BuildCore(VM* vm);
void BindMethod(VM* vm, Class* objClass, uint32_t index, Method method);
void BindSuperClass(VM* vm, Class* subClass, Class* superClass);

int EnsureSymbolExist(VM *vm, SymbolTable *table, const char *symbol, uint32_t length);

#endif //VANTIDEL_CPP_CORE_H
